# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.


from twisted.web import soap, server
from twisted.internet import reactor, defer


class Example(soap.SOAPPublisher):
    """
    It publishs two methods, 'add' and 'echo'.
    """

    def soap_echo(self, x):
        return x

    def soap_add(self, a=0, b=0):
        return a + b
    soap_add.useKeywords = 1

    def soap_deferred(self):
        return defer.succeed(2)

    def soap_getlist(self):
        return ['1','2','3','4','5','6','767']

    def soap_getdict(self):
        return {"a": ["b", "c", 12, []], "D": "foo"}

reactor.listenTCP(8080, server.Site(Example()))
reactor.run()
